package com.yunyi.thread.demo;

import java.util.concurrent.*;

public class PoolTest {
    public static void main(String[] args) {

        hand();
    }


    private static void pool() {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(3, 3, 30,
                TimeUnit.SECONDS, new ArrayBlockingQueue<>(50000), new ThreadPoolExecutor.AbortPolicy());
        threadPoolExecutor.execute(() -> {
            try {
                Thread.sleep(3000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("11111");

        });

    }


    private static void hand() {
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.execute(() -> {
            try {
                Thread.sleep(3000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("222222");
        });
    }

}
